
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
    document.documentElement.classList.add('dark')
} else {
    document.documentElement.classList.remove('dark')
}

$('#title').text(lang.easyLearnHistory);
$('#body-easy-learn').text(lang.easyLearn);

$('#btnTheme')[0].addEventListener("click", () => {
    localStorage.setItem("theme", localStorage.getItem("theme") == "dark" ? "light" : "dark");
    if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
        document.documentElement.classList.add('dark')
    } else {
        document.documentElement.classList.remove('dark')
    }
});

$('#btnLang')[0].addEventListener("click", () => {
    localStorage.setItem("lang", localStorage.getItem("lang") == "en" ? "zh" : "en");
    console.log('oraa:', location)
    const loc = document.location;
    const href = loc.href;
    // location.reload(location.origin + `/views/${localStorage.getItem("lang")}/index.html`);
});